package com.hspedu.web.entity;

import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

public class Car {
    @NotEmpty
    private String bandName;//品牌名
    @NotNull(message = "价格不为空")
    @NumberFormat(pattern = "###,###.##")
    private Float price;
    @NotNull(message = "数量不能为空")
    @Range(min = 1,max = 10)
    private Integer num;
    @NotNull(message = "上市时间不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;//上市时间

    @Override
    public String toString() {
        return "Car{" +
                "bandName='" + bandName + '\'' +
                ", price=" + price +
                ", num=" + num +
                ", time=" + time +
                '}';
    }

    public String getBandName() {
        return bandName;
    }

    public void setBandName(String bandName) {
        this.bandName = bandName;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Car(String bandName, Float price, Integer num, Date time) {
        this.bandName = bandName;
        this.price = price;
        this.num = num;
        this.time = time;
    }

    public Car() {
    }
}
